package com.special.threademo.common.list;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.HashSet;

/**
 * @author LiuYC
 * @version 1.0.0
 * @create 2020-12-30 13:14
 */
@Slf4j
public class RetainAddall {
    public static void main(String[] args) {
        HashSet<String> choices = new HashSet<>();
        HashSet<String> answers = new HashSet<>();
        //ArrayList<String> answers = new ArrayList<>();
        choices.add("11");
        choices.add("22");
        choices.add("33");
        choices.add("44");
        answers.add("11");
        answers.add("44");
        answers.add("33");
        answers.add("22");
       choices.retainAll(answers);
       log.info("retainsall===========================");
        System.out.println(choices);
        System.out.println((choices.equals(answers)));
       choices.removeAll(answers);
       log.info("removeall ===========================");
        System.out.println(choices);
        System.out.println((choices.equals(answers)));
       choices.addAll(answers);
       log.info("addall ===========================");
        System.out.println(choices);
        System.out.println((choices.equals(answers)));


    }

    ;
}
